package com.wj.service.imp;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wj.mapper.BugallMapper;
import com.wj.pojo.Bugall;
import com.wj.service.BugAllService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

//bug列表业务
@Service("bugAllService")
public class BugAllServiceImpl implements BugAllService {

    @Autowired
    private BugallMapper bugallMapper;

    //分页条件查询
    public PageInfo<Bugall> findByPage(int page, int limit, Map<String, Object> map) {
        PageHelper.startPage(page,limit);
        List<Bugall> bugallList = bugallMapper.findByPage(map);
        PageInfo<Bugall> pageInfo = new PageInfo<Bugall>(bugallList);
        return pageInfo;
    }

    //添加bug信息
    public void add(Bugall bugall) {
        bugallMapper.insert(bugall);
    }

    //修改bug信息
    public int upd(Bugall bugall) {
        int i = bugallMapper.updateByPrimaryKey(bugall);
        return i;
    }
}
